/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundless.managedbeans;

import boundless.ejb.RequestBean;
import boundless.entities.Account;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

/**
 *
 * @author matt
 */
@Named
@RequestScoped
public class AccountManager {
    protected Account newAccount;

    @EJB
    RequestBean req;

    public AccountManager() {
        this.newAccount = new Account();
    }

    public Account getNewAccount() {
        return newAccount;
    }

    public void setNewAccount(Account newAccount) {
        this.newAccount = newAccount;
    }
    
    public String login(String username, String password) {
        Account acc = req.isValidUserPassPair(username, password);
        
        if(acc == null) {
            return "loginError";
        }
        else {
            return "loginSuccess";
        }
        
        /*if(username.equals("boundless") && password.equals("boundless"))
        {
            return "loginSuccess";
        }
        return "loginError";*/
    }
}
